export function range (start = 0, end: number, step = 1) {
  const ret = []
  for (let i = start; i < end; i++) {
    ret.push(i)
  }
  return ret
}

export function randomString (len = 4): string {
  const nums = range(48, 58)
  const chars = range(65, 91)
  const all = [...nums, ...chars]
  const ret = []
  for (let i = 0; i < len; i++) {
    const sum = Math.floor(Math.random() * 1000)
    const remainder = sum % all.length
    const ch = String.fromCharCode(all[remainder])
    ret.push(ch)
  }
  return ret.join('')
}
